package com.Main;
import java.io.*;
import java.net.*;
import java.nio.ByteBuffer;

class TCPClient
{
 public static void main(String argv[]) throws Exception
 {
  String modifiedSentence;
  Socket clientSocket = new Socket("192.168.56.101", 19400);
  DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
  BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  
  ByteBuffer b = ByteBuffer.allocate(4);
	//b.order(ByteOrder.BIG_ENDIAN); // optional, the initial order of a byte buffer is always BIG_ENDIAN.
	b.putInt(0xAABBCCDD);

	byte[] result = b.array();
	
  //outToServer.writeBytes(sentence + '\n');
 // byte [] message = new byte []{1,0,3,1,0,0,0,16,0,17,0,8,0,0,0,1}; 
  outToServer.write(result);
  modifiedSentence = inFromServer.readLine();
  System.out.println("FROM SERVER: " + modifiedSentence);
  clientSocket.close();
 }
 
 public static final byte[] intToByteArray(int value) {
	    return new byte[] {
	            (byte)(value >>> 24),
	            (byte)(value >>> 16),
	            (byte)(value >>> 8),
	            (byte)value};
	}

}